<?php

class HOwner extends CModel  {
	/**
	 * @var integer $id
	 * @soap
	 */
	public $id ;

	/**
	 * @var string $first_name
	 * @soap
	 */
	public $first_name ;

	/**
	 * @var string $last_name
	 * @soap
	 */
	public $last_name ;

	/**
	 * @var string $gender
	 * @soap
	 */
	public $gender ;

	/**
	 * @var date $birth_date
	 * @soap
	 */
	public $birth_date ;

	/**
	 * @var string $address1
	 * @soap
	 */
	public $address1 ;

	/**
	 * @var string $address2
	 * @soap
	 */
	public $address2 ;

	/**
	 * @var string $address3
	 * @soap
	 */
	public $address3 ;

	/**
	 * @var integer $city_id
	 * @soap
	 */
	public $city_id ;

	/**
	 * @var string $email
	 * @soap
	 */
	public $email ;

	/**
	 * @var string $phone_number
	 * @soap
	 */
	public $phone_number ;

	/**
	 * @var string $referent
	 * @soap
	 */
	public $referent ;

	/**
	 * @var integer $service_id
	 * @soap
	 */
	public $service_id ;

	/**
	 * @var string $adviser_initials
	 * @soap
	 */
	public $adviser_initials ;

	/**
	 * @var HOwnerSpecificData[] $specific_data
	 * @soap
	 */
	public $specific_data ;

	public function attributeNames() {
		return array ('id','first_name','last_name','gender','birth_date','address1','address2','address3','city_id','email','phone_number','referent','service_id','adviser_initials','specific_data');
	}

	public function setAttributes($values,$safeOnly=true)
	{
		if (array_key_exists('specific_data', $values)){
			if (is_array($values['specific_data'])) {
				$data = array();
				foreach ($values['specific_data'] as $m) {
					if (!($m instanceof HOwnerSpecificData) && ($m instanceof OwnerSpecificData)) {
						$datum = new HOwnerSpecificData();
						$datum->attributes = $m->attributes;
						$data[] = $datum;
					} else if (is_array($m)) {
						$datum = new HOwnerSpecificData();
						$datum->attributes = $m;
						$data[] = $datum;
					} else if ($m instanceof HOwnerSpecificData) {
						$data[] = $m;
					}
				}
				$values['specific_data'] = $data;
			}
		}
				
		parent::setAttributes($values, $safeOnly);
	}

	public function __toString() {
		return "HOwner [" .
			"id=" . $this->id .
			", first_name=" . $this->first_name .
			", last_name=" . $this->last_name .
			", gender=" . $this->gender .
			", birth_date=" . $this->birth_date .
			", address1=" . $this->address1 .
			", address2=" . $this->address2 .
			", address3=" . $this->address3 .
			", city_id=" . $this->city_id .
			", email=" . $this->email .
			", phone_number=" . $this->phone_number .
			", referent=" . $this->referent .
			", service_id=" . $this->service_id .
			", adviser_initials=" . $this->adviser_initials .
			", specific_data=" . $this->specific_data .
			"]";
	}
}
